<template>
  <div>
    <!-- <video :id="detail.identifier" :height="this.detail.style.position.h" :width="this.detail.style.position.w" autoplay
           controls
           muted
           style="background-color: black;"
    ></video> -->
    <LivePlayer :videoUrl="videoUrl" :id="detail.identifier" :height="this.detail.style.position.h" :width="this.detail.style.position.w" fluent autoplay live  controls
           
           style="background-color: black;" muted></LivePlayer>
    <div v-show="false">{{ videoUrl }}</div>
  </div>
</template>

<script>
import LivePlayer from '@liveqing/liveplayer' 
import BaseView from './View';


export default {
  name: 'view-live-player',
  extends: BaseView,
  props: {},
  components: {
    LivePlayer
  },
  data() {
    return {
      // flvPlayer: null
    }
  },
  computed: {
    videoUrl() {
      // this.$nextTick(function () {
      //   if (flvjs.isSupported()) {
      //     var videoElement = document.getElementById(this.detail.identifier);
      //     this.flvPlayer = flvjs.createPlayer({
      //       type: 'flv',
      //       isLive: true,
      //       hasAudio: false,
      //       url: this.detail.videoUrl
      //     });
      //     this.flvPlayer.attachMediaElement(videoElement);
      //     this.flvPlayer.load();
      //     this.flvPlayer.play();
      //   }
      // });
      return this.detail.videoUrl
    },
  },
  mounted() {
    // if (flvjs.isSupported()) {
    //   var videoElement = document.getElementById(this.detail.identifier);
    //   this.flvPlayer = flvjs.createPlayer({
    //     type: 'flv',
    //     isLive: true,
    //     hasAudio: false,
    //     url: this.detail.videoUrl
    //   });
    //   this.flvPlayer.attachMediaElement(videoElement);
    //   this.flvPlayer.load();
    //   this.flvPlayer.play();
    // }
  },
  methods: {
    // play() {
    //   this.flvPlayer.play();
    // }
  }
}
</script>

<style lang="scss">
.view-text {
  height: 100%;
  width: 100%;
}

.demo {
  padding: 5px;
  background-color: rgba(0, 206, 209, 0);
}
</style>
